
*     *****************************************************************   *;
*     *****************************************************************   *;
*   File-Name:     CCA_Replication.do         				              *;
*   Date:          March 31, 2021                                  	      *;
*   Authors:       Ece Kural and Lisa Dellmuth	   				          *;
*   Input File:    CCA_Replication.dta		                              *; 
*   Related paper: International Organizations and Climate Change   	  *; 
*                  Adaptation: A New Dataset for the Social Scientific    *;
*                  Study of Adaptation, 1990–2017 		   				  *;
*     ****************************************************************    *;
*     ****************************************************************    *;

* Stata/IC 15.1
vers 15.1

set more off 
use "/Users/CCA_Replication.dta" 

****************************************************************
***<<<<Index Creation
****************************************************************
gen index=priority+timehorizon+funding+staffing
egen maxindex=max(index)
replace index=(index/maxindex)*100
**Normalization of index components were carried out in a data preparation file. 
*

****************************************************************
***<<<<FIGURE 1
****************************************************************

preserve 

collapse (mean) index, by(year)
twoway line index year, ytitle("Adaptation Engagement across 30 IOs, 1990–2017 (Index)") xtitle("Year") xlabel(1990(1)2017) xlabel(, angle(45))

restore

****************************************************************
***<<<<FIGURE 2
****************************************************************

preserve 

rename response_no responses

collapse (sum) inst (sum) responses (sum) statement (sum) event (sum) framework (sum) ///
fund (sum) operational (sum) reports , by(year)

order responses, b(inst)

egen response_sum=rowtotal(inst-reports)

drop responses 

foreach var of varlist inst-response_sum {
egen float `var'sum1 = sum(`var') if tin(1990, 1995)
egen float `var'sum2 = sum(`var') if tin(1996, 2000)
egen float `var'sum3 = sum(`var') if tin(2001, 2005)
egen float `var'sum4 = sum(`var') if tin(2006, 2010)
egen float `var'sum5 = sum(`var') if tin(2011, 2017)
label variable `var'sum1 "1995"
label variable `var'sum2 "2000"
label variable `var'sum3 "2005"
label variable `var'sum4 "2010"
label variable `var'sum5 "2017"
replace `var'sum1=`var'sum2 if `var'sum1==.
replace `var'sum1=`var'sum3 if `var'sum1==.
replace `var'sum1=`var'sum4 if `var'sum1==.
replace `var'sum1=`var'sum5 if `var'sum1==.
}

keep year response_sum instsum1 response_sumsum1 statementsum1 eventsum1 frameworksum1 fundsum1 operationalsum1 reportssum1

drop response_sum

keep if year == 1990 | year == 1996 | year == 2001 | year == 2006 | year == 2011

set scheme s1manual

egen responsessum1=rowtotal(instsum1-reportssum1)

gen pstatement=statementsum1/responsessum1
gen pframework=frameworksum1/responsessum1
gen poperational=operationalsum1/responsessum1
gen pinst=instsum1/responsessum1
gen preports=reportssum1/responsessum1
gen pfund=fundsum1/responsessum1
gen pevent=eventsum1/responsessum1

label define year 1990 "1990-1995" 1996 "1996-2000" 2001 "2001-2005" 2006 "2006-2010" 2011 "2011-2017"

graph bar pstatement pframework poperational pinst preports pfund pevent, /// 
ylab(0 "0%" .25 "25%" .5 "50%" .75 "75%" 1 "100%")  over(year) stack  ///
legend(col(3) pos(6) size(vsmall) lab(1 "Declarations and statements") /// 
lab(2 "Frameworks") lab(3 "Projects and programs") lab(4 "Institution building") ///
lab(5 "Publication of reports") lab(6 "Funding or fund creation")  ///
lab(7 "Events")) 

restore


****************************************************************
***<<<<FIGURE 3
****************************************************************

preserve 

rename response_no responses

collapse (sum) responses (sum) ecr (sum) hsr (sum)  ssr (sum)  ensr  , by(year)

foreach var of varlist responses-ensr {
egen float `var'sum1 = sum(`var') if tin(1990, 1995)
egen float `var'sum2 = sum(`var') if tin(1996, 2000)
egen float `var'sum3 = sum(`var') if tin(2001, 2005)
egen float `var'sum4 = sum(`var') if tin(2006, 2010)
egen float `var'sum5 = sum(`var') if tin(2011, 2017)
label variable `var'sum1 "1995"
label variable `var'sum2 "2000"
label variable `var'sum3 "2005"
label variable `var'sum4 "2010"
label variable `var'sum5 "2017"
replace `var'sum1=`var'sum2 if `var'sum1==.
replace `var'sum1=`var'sum3 if `var'sum1==.
replace `var'sum1=`var'sum4 if `var'sum1==.
replace `var'sum1=`var'sum5 if `var'sum1==.
}

keep year responses responsessum1 ecrsum1 hsrsum1 ssrsum1 ensrsum1

keep if year == 1990 | year == 1996 | year == 2001 | year == 2006 | year == 2011

set scheme s1manual

egen sum = rowtotal(ecrsum1-ensrsum1)
 
gen pecr=ecrsum1/sum
gen phsr=hsrsum1/sum 
gen pssr=ssrsum1/sum
gen pens=ensrsum1/sum

graph bar pecr phsr pssr pens, /// 
ylab(0 "0%" .25 "25%" .5 "50%" .75 "75%" 1 "100%") over(year)  stack  ///
legend(col(2) pos(6) size(vsmall) lab(1 "Economic Framing") /// 
lab(2 "Human Security Framing") lab(3 "State Security Framing") lab(4 "Energy Security Framing"))  

restore

****************************************************************
***<<<<FIGURE 4
****************************************************************

preserve  

decode IOarea, gen (IOarean)
order IOarean, a(IOarea)

replace IOarean=" Regional Cooperation" if IOarean== "Regional (Africa)" | IOarean== "Regional (America)" | IOarean== "Regional (Asia/Ocenia)" | IOarean=="Regional (Europe)"

drop IOarea
encode IOarean, gen (IOarea)
order IOarea, a(IOarean)
drop IOarean

collapse (mean) index, by(IOarea)


graph hbar index, over (IOarea, sort(1) descending)  ///
ytitle("IO Adaptation Engagement Index") ylabel(0(5)25) 

restore
 
****************************************************************
***<<<<FIGURE 5
****************************************************************
preserve 
 
drop if index==.

keep if year<2007

collapse (mean) index, by(pri_region) 

label define pri_region 0 "Global" 1 "Africa" 2 "Asia" 3 "Europe" 8 "Americas"

graph hbar index /// 
, over (pri_region, sort(1) descending)  ///
blabel(bar, format(%9.3g) position(outside) size(small)) ///
ytitle("IO Adaptation Engagement Index (1990-2006)") ylabel(0(5)25) ///
saving(fig5.1.gph, replace)

restore

preserve
 
ed IO IOname year regional pri_region index
drop if index==.

keep if year>2006

collapse (mean) index, by(pri_region) 

label define pri_region 0 "Global" 1 "Africa" 2 "Asia" 3 "Europe" 8 "Americas"

graph hbar index /// 
, over (pri_region, sort(1) descending)  ///
blabel(bar, format(%9.3g) position(outside) size(small)) ///
ytitle("IO Adaptation Engagement Index (2007-2017)") ylabel(0(5)25) ///
saving(fig5.2.gph, replace)

restore

graph combine fig5.1.gph fig5.2.gph 



****************************************************************
***<<<<FIGURE 6
****************************************************************

preserve 
collapse (mean) index, by(IOname)
label variable index "IO Adaptation Engagement Index , 1990-2017"
graph hbar index, over (IOname, sort(1) descending) bar(6, bcolor(red)) ysize(10) ytitle("IO Adaptation Engagement Index 1990-2017") ylabel(0(5)40) blabel(bar, format(%9.3g) position(outside) size(small)) bargap(20)
restore



****************************************************************
***<<<<FIGURE A1, supplementary files
****************************************************************

gen lrev=ln(revenue_million)

collapse index funding revenue_million, by(IO)

twoway (scatter index revenue_million, mlabel(IO) saving(a.gph, replace) xtitle(Mean IO Annual Revenue in Million USD) ytitle(Mean Adaptation Engagement Index)) ///
(lfit index revenue_million)
twoway (scatter index revenue_million  if IO!=8, mlabel(IO) saving(b.gph, replace) xtitle(Mean IO Annual Revenue in Million USD)) (lfit index revenue_million  if IO!=8)

graph combine a.gph b.gph, ycommon col(2)





